package com.example.mulactivity

import android.content.Intent
import android.os.Bundle
import android.util.Log
import android.widget.Button
import android.widget.EditText
import androidx.activity.enableEdgeToEdge
import androidx.appcompat.app.AppCompatActivity
import androidx.core.view.ViewCompat
import androidx.core.view.WindowInsetsCompat

class MainActivity3 : AppCompatActivity() {
    val MainTag = "MainActivity3"
    override fun onCreate(savedInstanceState: Bundle?) {
        super.onCreate(savedInstanceState)
        enableEdgeToEdge()
        setContentView(R.layout.activity_main3)
        ViewCompat.setOnApplyWindowInsetsListener(findViewById(R.id.main)) { v, insets ->
            val systemBars = insets.getInsets(WindowInsetsCompat.Type.systemBars())
            v.setPadding(systemBars.left, systemBars.top, systemBars.right, systemBars.bottom)
            insets
        }
        val editText = findViewById<EditText>(R.id.editTextText)
        val button = findViewById<Button>(R.id.button)

        button.setOnClickListener {
            val name = editText.text.toString()
            val inten = Intent()
            intent.putExtra("name",name)
            setResult(RESULT_OK,intent)
            finish()
        }
        Log.d(MainTag,"onCreate")
    }
    override fun onStart() {
        super.onStart()
        Log.d(MainTag,"onStart")
    }

    override fun onResume() {
        super.onResume()
        Log.d(MainTag,"onResume")
    }

    override fun onPause() {
        super.onPause()
        Log.d(MainTag,"onPause")
    }

    override fun onStop() {
        super.onStop()
        Log.d(MainTag,"onStop")
    }

    override fun onRestart() {
        super.onRestart()
        Log.d(MainTag,"onRestart")
    }

    override fun onDestroy() {
        super.onDestroy()
        Log.d(MainTag,"onDestroy")
    }

}